<!DOCTYPE html>
<html>
<head>
    <title>码单显示</title>
    <script language="javascript" src="Resource/Script/jquery.js"></script>
    {webcontrol type='LoadJsCss' src="Resource/Script/Print/2017.01.04/LodopFuncs.js"}
</head>
{literal}
 
 <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0> 
    <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0 pluginspage="install_lodop.exe"></embed>
    <param name="CompanyName" value="常州易奇信息科技有限公司">
    <param name="License" value="664717080837475919278901905623">
  </object> 
<script language="javascript">
var LODOP; //声明为全局变量
function prnbutt_onclick() { 
    //去增加打印次数
    var gangId = document.getElementById('ganghao').value;
    var url = 'Index.php?controller=Chengpin_Dye_Cpck&action=AddPrintTimes';
    $.getJSON(url,{gangId:gangId},function(json){
         if(!json.success){
            alert('更新打印次数失败');
         }
    });
    // window.print(); 
    // return true; 
} 

function window_onbeforeprint() { 
    document.getElementById("prnbutt").style.visibility ="hidden"; 
    return true; 
} 

function window_onafterprint() { 
    document.getElementById("prnbutt").style.visibility = "visible"; 
    return true; 
}


function PrintTable(){
    prnbutt_onclick();
    //加载打印控件
    LODOP=getLodop(document.getElementById('LODOP_OB'),document.getElementById('LODOP_EM'));
    //设置纸张  
    //LODOP.SET_PRINT_PAGESIZE(0,'203mm','290mm','A4')
    LODOP.PRINT_INIT("易奇科技报表打印");
    LODOP.SET_PRINT_PAGESIZE(2,'210mm','140mm','');
    //设置居中显示LODOP.ADD_PRINT_HTM(Top,Left,Width,Height,strHtml)
    //in(英寸)、cm(厘米) 、mm(毫米) 、pt(磅)、px(1/96英寸) 、%(百分比)，如"10mm"表示10毫米。
    LODOP.ADD_PRINT_HTM("1%", "0%", "110%", "115%", document.getElementById("bodyDiv").innerHTML);
    LODOP.SET_PRINT_STYLEA(0,"Horient",1);
    //LODOP.ADD_PRINT_BARCODE(40,30,151,39,"",$('#barcode').attr('data-barcode'));
    //预览
    //LODOP.PRINT_DESIGN();
    LODOP.PREVIEW();    
};
</script>
<style type="text/css">
.style1 {
    font-size: 14px;
    font-weight: bold;
}
body {
    margin:0 auto;
}
#bodyDiv{margin:0 auto; text-align:center;}
#TblMainInfo{border-collapse:collapse; border:solid 1px black; width:100%;margin: 0 auto;margin-top: 10px}
#TblMainInfo td {FONT-FAMILY:"宋体,Arial";FONT-SIZE:14px;COLOR:#000;}
/*打印按钮样式*/
#divPrint { position:fixed; bottom:10px; right:250px;}
#divPrint input {  background-color: #0362fd !important; border:0px; color: #fff !important; font-family: "Segoe UI",Helvetica,Arial,sans-serif;cursor: pointer; outline: medium none; font-size:14px; padding: 7px 14px;}
</style>
{/literal}
<body>

<div id="bodyDiv" style="position: relative;">
{foreach from=$info item=item key=k}
  <style type="text/css">
        {literal}
            td{font-size:13px;height: 21px;}
            td span{font-weight:bold;}
            .haveBorder{border:1px solid #000;}
            .headDiv{width: 70%;margin: 0 auto}
            .titles{margin: 0 auto;font-size: 16px;margin-left: 100px}
            .title_right{float: right;margin-right: 40px}
            .madan{text-align: center;}
            .dd{page-break-after: always;}
            /*.divs td {border:1px solid #000;}*/
        {/literal}
  </style>
<div class="dd">
<div class="headDiv">
    <div class="titles" style="font-size: 18px">{$MdcompName}磅码单</div>
    <div class="title_right">{$aRow.dateInput}</div>
</div>
<table border="1" cellspacing="0" cellpadding="0" id="TblMainInfo" style="width: 85%" id="div2" class="divs">
    <tr>
        <td align="center" width="15%">客户名称：</td>
        <td width="20%" align="center" colspan="2">{$aRow.compName}</td>
        <td align="center"  width="13%">客户号：</td>
        <td width="20%" align="center" colspan="2">{$aRow.compCode}</td>
        <td align="center"  width="13%">缸号：</td>
        <td width="20%" align="center" colspan="2">{$aRow.vatNum}</td>
    </tr>
     <tr>
        <td align="center" width="13%">品种：</td>
        <td width="20%" align="center" colspan="2">{$aRow.wareName}</td>
        <td align="center"  width="13%">色号：</td>
        <td width="20%" align="center" colspan="2">{$aRow.colorNum}</td>
        <td align="center"  width="15%">计划投料：</td>
        <td width="20%" align="center" colspan="2">{$aRow.cntPlanTouliao}</td>
    </tr>
      <tr>
        <td align="center" width="13%">规格：</td>
        <td width="20%" align="center" colspan="2">{$aRow.guige}</td>
        <td align="center"  width="13%">颜色：</td>
        <td width="20%" align="center" colspan="2">{$aRow.color}</td>
        <td align="center"  colspan="3"></td>
    </tr>
    </table>
    <table border="1" cellspacing="0" cellpadding="0" id="TblMainInfo" style="width: 85%" id="div2" class="divs" style="margin-top: 2px;">
    <tr>
        <td class="madan" style="width: 5%">件号</td>
        <td class="madan" style="width: 8%">毛重</td>
        <td class="madan" style="width: 8%">净重</td>
        <td class="madan" style="width: 8%">筒子数</td>
        <td class="madan" style="width: 5%">件号</td>
        <td class="madan" style="width: 8%">毛重</td>
        <td class="madan" style="width: 8%">净重</td>
        <td class="madan" style="width: 8%">筒子数</td>
        <td class="madan" style="width: 5%">件号</td>
        <td class="madan" style="width: 8%">毛重</td>
        <td class="madan" style="width: 8%">净重</td>
        <td class="madan" style="width: 8%">筒子数</td>
    </tr>
    {if $item}
    {foreach from=$item item=son key=key}
    {assign var=i value=$key}
    {foreach from=$temp item=it key=k}
    {assign var=rowNumF value=$i+1}
    {assign var=rowNumFl value=$i}
    {assign var=rowNumT value=$i+20+1}
    {assign var=rowNumTl value=$i+20}
    {assign var=rowNumV value=$i+40+1}
    {assign var=rowNumV1 value=$i+40}
    {if $key==1}
    <tr>
       <td class="madan">{$rowNumF-1}</td>
       <td class="madan">{$item[$rowNumFl].maozhong}</td>
       <td class="madan">{$item[$rowNumFl].jingzhong}</td>
       <td class="madan">{$item[$rowNumFl].cntTongzi}</td>
       <td class="madan">{$rowNumT-1}</td>
       <td class="madan">{$item[$rowNumTl].maozhong}</td>
       <td class="madan">{$item[$rowNumTl].jingzhong}</td>
       <td class="madan">{$item[$rowNumTl].cntTongzi}</td>
       <td class="madan">{$rowNumV-1}</td>
       <td class="madan">{$item[$rowNumV1].maozhong}</td>
       <td class="madan">{$item[$rowNumV1].jingzhong}</td>
       <td class="madan">{$item[$rowNumV1].cntTongzi}</td>
    </tr>
    {/if}
    {assign var=i value=$i+1}
    {/foreach}
    {/foreach}
    {else}
    {assign var=i value=0}
    {foreach from=$temp1 item=it key=k}
    {assign var=rowNumF value=$i+1}
    {assign var=rowNumT value=$i+20+1}
    {assign var=rowNumV value=$i+40+1}
    <tr>
        <td class="madan">{$rowNumF}</td>
        <td class="madan"></td>
        <td class="madan"></td>
        <td class="madan"></td>
        <td class="madan">{$rowNumT}</td>
        <td class="madan"></td>
        <td></td>
        <td class="madan"></td>
        <td class="madan">{$rowNumV}</td>
        <td class="madan"></td>
        <td class="madan"></td>
        <td class="madan"></td>
    </tr>
    {assign var=i value=$i+1}
    {/foreach}
    {/if}
    <tr>
        <td colspan="2">总计：</td>
        <td colspan="10" align="left">
            &nbsp;{$counts}件 &nbsp;&nbsp;&nbsp;筒子数：{$cntTongziAll}&nbsp;&nbsp;&nbsp;毛重{$maozhongAll}&nbsp;&nbsp;&nbsp;净重{$jingzhongAll}
        </td>
    </tr>
    <tr>
        <td width="10%" style="font-size: 11px" colspan="2">仓库验收人：</td>
        <td colspan="2"></td>
        <td align="center" colspan="2">磅码人：</td>
        <td colspan="6" align="left">&nbsp;{$aRow.perName}</td>
    </tr>
<!--     <tr>
        <td>备注：</td>
        <td colspan="8"></td>
    </tr> -->
</table>
</div>
{/foreach}
</div>

<!-- 打印按钮 -->
<div id="divPrint" class="wrap">
    <input type="button" name="button" id="button" value="打印" onclick="PrintTable()"/>
</div>
<div id=prn align="center">
<!-- <input id=prnbutt onClick="return prnbutt_onclick()" type=button value="打印"> -->
<input type="hidden" id="ganghao" name="ganghao" value="{$aRow.gangId}" />
</div>
</body>
</html>